<?php
namespace Home\Model;
use Think\Model\RelationModel;

class CourseModel extends RelationModel{

    protected $_link = array(
        "class"=>array(
            "mapping_type"=>3,
            "class_name" => "class",
            "mapping_name" => "class",
            "foreign_key"=> "cou_id",
            "parent_key"=>"cou_id",
        )
    );

    protected $_validate = array(
        //查询
        array("cou_id","number","课程id必须是正整数!",1,"regex",4),
        array("teacher_tea_id","number","教师id必须是正整数!",1,"regex",4),
        //新增课程
        array("cou_name","require","课程名称不能为空!",1,"regex",1),
        array("teacher_tea_id","number","教师id必须是正整数!",1,"regex",1),
        array("is_available",array(0,1),"是否启用出错!",1,"in",3),            //修改也可以用
    );
}